import { INestApplication } from '@nestjs/common';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';

/** 使用swagger */
export const setupSwagger = (app: INestApplication) => {
  const options = new DocumentBuilder()
    .addBearerAuth({
      description: 'JWT Authorization',
      type: 'http',
      in: 'header',
      scheme: 'bearer',
      bearerFormat: 'JWT',
    })
    .setTitle('vue3-template-api')
    .setDescription('vue3-template 的接口文档')
    .setVersion('1.0.0')
    .build();
  const document = SwaggerModule.createDocument(app, options);
  SwaggerModule.setup('/api-docs', app, document);
};
